From: Jan Beulich Date: Tue, 11 Feb 2014 10:11:48 +0000 (+0100) Subject: flask: fix memory leaks X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5592 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=57c9f2caf05de41913b3e4eb48c0c3ad6c18dd3f;p=xen.git flask: fix memory leaks Plus, in the case of security_preserve_bools(), prevent double freeing in the case of security_get_bools() failing. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Acked-by: Daniel De Graaf --- diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c index 4b93e71e77..e4b07eb04e 100644 --- a/xen/xsm/flask/flask_op.c +++ b/xen/xsm/flask/flask_op.c @@ -347,6 +347,7 @@ static int flask_security_set_bool(struct xen_flask_boolean *arg) if ( arg->bool_id >= num ) { + xfree(values); rv = -ENOENT; goto out; } diff --git a/xen/xsm/flask/ss/services.c b/xen/xsm/flask/ss/services.c index 5cb9537be1..60673175b7 100644 --- a/xen/xsm/flask/ss/services.c +++ b/xen/xsm/flask/ss/services.c @@ -1902,6 +1902,7 @@ err: { for ( i = 0; i < *len; i++ ) xfree((*names)[i]); + xfree(*names); } xfree(*values); goto out; @@ -2011,7 +2012,7 @@ static int security_preserve_bools(struct policydb *p) rc = security_get_bools(&nbools, &bnames, &bvalues, NULL); if ( rc ) - goto out; + return rc; for ( i = 0; i < nbools; i++ ) { booldatum = hashtab_search(p->p_bools.table, bnames[i]);